﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.Util;
using Com.CMS263.PO;
using Com.CMS263.BLL;
using System.IO;

namespace Com.CMS263.Web.manage.OrderManage
{
    public partial class order_show : System.Web.UI.Page
    {
        public CustomerListBLL custbll = new CustomerListBLL();
        UserOrderBLL pbll = new UserOrderBLL();
        public UserOrder ab = new UserOrder();
        public ArtBaseBLL abbll = new ArtBaseBLL();
        public XxInfo xxinfo = new XxInfo();
        XxInfoBLL xxbll = new XxInfoBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                
                BindData();
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {

            int id = Convert.ToInt32(Request["id"]);
            ab = (UserOrder)pbll.FindModelById("UserOrder", id);
            int editstate = Convert.ToInt32(Request["txtBatch"]);
            ab.State = editstate;
            pbll.entity = ab;
            if (pbll.UpDate())
            {
                StringUtil.Alert("修改成功", "order_list.aspx");
            }


        }
        public void BindData()
        {
            int id = Convert.ToInt32(Request["id"]);
            if (id <= 0)
            {
                StringUtil.Alert("抱歉，没有找到相关数据", "order_list.aspx");
            }
            ab = (UserOrder)pbll.FindModelById("UserOrder", id);
            xxinfo = xxbll.GetXxinfo(ab.UserId);
        }
        ProductBLL prodbll = new ProductBLL();
        public string GetProductTitle(int id)
        {
            Product prod = new Product();
            prod = (Product)prodbll.FindModelById("Product", id);
            if (prod == null && prod.Id < 1)
            {
                prod = new Product();
            }
            return prod.Title;
        }
    }
}
